#pragma glslify: perlin = require('glsl-noise/simplex/3d.glsl')
varying vec2 vUv;

uniform float uTime;

void main(){
    //传递uv到片元着色器
    vUv = uv;
    float noiseValue = perlin(vec3(vUv * 10.0, uTime));
    vec4 modelPosition = modelMatrix * vec4(position, 1.0);
    vec4 newPosition = vec4(modelPosition.x, modelPosition.y + noiseValue * 0.2, modelPosition.z, modelPosition.w);
    // vec3 newPosition = vec3(position.x, position.y, position.z);
    // float noiseValue = perlin4(vec4(position * 10.0, uTime));
    // vec3 newPosition = vec3(perlin(position.x),perlin(position.y),perlin(position.z));
    // float noiseValue = perlin(vec3(vUv, uTime));
    // gl_Position = projectionMatrix * modelViewMatrix * vec4(position + position * noiseValue * 0.1, 1.0);
    // gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
    gl_Position = projectionMatrix * viewMatrix * newPosition;
}